package com.lagou.mr.homework1;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class HomeWorkReducer extends Reducer<NumberBean, NullWritable, Text,NullWritable> {
    Text text = new Text(  );
    int i = 0;
    @Override
    protected void reduce(NumberBean key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        i++;
        Integer num = key.getNum();
        String filed = i +"\t"+ num.toString();
        text.set(  filed);
        context.write( text,NullWritable.get() );

    }
}
